package com.xinyuan.service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @Classname getJson
 * @Description TODO
 * @Date 2020/5/21 17:22
 * @Created by zfl
 */
public class GetJson {

    public String getJson (Object obj) throws JsonProcessingException {
        //将message对象序列化为json
        ObjectMapper mapper = new ObjectMapper();
        String json = mapper.writeValueAsString(obj);
        return json;
    }
}
